import Vue from 'vue'
import VueRouter from 'vue-router'
// import store from '../store';
import Login from '../views/Login.vue'

Vue.use(VueRouter)
let originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(path) {
    return originalPush.call(this, path).catch(err => err)
}
const routes = [{
        path: '/',
        name: 'Login',
        component: Login
    },
    {
        path: '/navList',
        name: 'NavList',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
            import ( /* webpackChunkName: "about" */ '../components/navList/NavList'),
        children: [{
                path: '',
                name: 'firstpage',
                component: () =>
                    import ('../components/navList/FirstPage'),
                meta: ['首页']
            },
            {
                path: '/merchantlist',
                name: 'merchantlist',
                component: () =>
                    import ('../components/navList/MerchantList'),
                meta: ['商户', '商户列表']
            },
            {
                path: '/businessinformation',
                name: 'businessinformation',
                component: () =>
                    import ('../components/navList/BusinessInformation'),
                meta: ['商户', '商户信息']
            },
            {
                path: '/brandlist',
                name: 'brandlist',
                component: () =>
                    import ('../components/navList/BrandList'),
                meta: ['商户', '品牌列表']
            },
            {
                path: '/storelist',
                name: 'storelist',
                component: () =>
                    import ('../components/navList/StoreList'),
                meta: ['商户', '店铺列表']
            },
            {
                path: '/storeinformation',
                name: 'storeinformation',
                component: () =>
                    import ('../components/navList/StoreInformation'),
                meta: ['商户', '店铺信息']
            },
            {
                path: '/partitionlist',
                name: 'partitionlist',
                component: () =>
                    import ('../components/navList/PartitionList'),
                meta: ['商户', '列巴']
            },
            {
                path: '/takeawayplatform',
                name: 'takeawayplatform',
                component: () =>
                    import ('../components/navList/TakeawayPlatform'),
                meta: ['商户', '外卖平台绑定']
            },
            {
                path: '/productlist',
                name: 'productlist',
                component: () =>
                    import ('../components/navList/ProductList'),
                meta: ['商品', '商品列表']
            },
            {
                path: '/productdetails',
                name: 'productdetails',
                component: () =>
                    import ('../components/navList/Productdetails'),
                meta: ['商品', '商品详情']
            },
            {
                path: '/commodity',
                name: 'commodity',
                component: () =>
                    import ('../components/navList/Commodity'),
                meta: ['商品', '商户分类']
            },
            {
                path: '/comboset',
                name: 'comboset',
                component: () =>
                    import ('../components/navList/Comboset'),
                meta: ['商品', '套餐设置']
            },
            {
                path: '/plansadd',
                name: 'plansadd',
                component: () =>
                    import ('../components/navList/Plansadd'),
                meta: ['商品', '套餐添加']
            },
            {
                path: '/takeawayplatform',
                name: 'takeawayplatform',
                component: () =>
                    import ('../components/navList/TakeawayPlatform'),
                meta: ['商户', '外卖平台绑定']
            },
            {
                path: '/elm',
                name: 'elm',
                component: () =>
                    import ('../components/navList/Elm'),
                meta: ['外卖', '饿了么授权']
            },
            {
                path: '/mt',
                name: 'mt',
                component: () =>
                    import ('../components/navList/Mt'),
                meta: ['外卖', '美团授权']
            },
        ]
    }
]
const router = new VueRouter({
    routes
})
export default router